package eventStrategies.stateMachine.strategyState;

import controller.AbstractController;
import utilities.Key;
import eventManager.AppEvent;
import eventManager.EventManager;
import eventStrategies.IEventResponse;
import events.ECodeEventList;
import events.HighlightObjectEvent;
import events.stateMachine.strategyState.OpenStarSystemWindowEvent;
import events.stateMachine.strategyState.ToReceiverWindowEvent;

public class SystemTileMouseSingleClick extends IEventResponse {

	public Key systemKey;
	private AbstractController controller;
	
	public SystemTileMouseSingleClick(AbstractController controller, Key systemKey) {
		super(ECodeEventList.MOUSE_SINGLE_CLICK);
		this.systemKey = systemKey;
		this.controller = controller;
	}

	@Override
	public void execute(AppEvent event) {
		//highlight this object
		controller.handleEvent(new HighlightObjectEvent(systemKey));
		
		//send out to game to open up a StarSystem window
		controller.processOutgoingEvent(new OpenStarSystemWindowEvent(systemKey));
		
		//send out to game to get to receiver window
		controller.processOutgoingEvent(new ToReceiverWindowEvent(systemKey));
		
	}

}
